#include<math.h>
#include<stdio.h>
int main()
{
	double pai, sum = 0, flag=1.0, i = 1.0;
	int n1=0, n2 = 1;
	while (fabs(flag) >= 1e-4)
	{
		flag = i / n2;
		sum = sum + flag;
		n1++;
		i = -i;
		n2 = n2 + 2;
	}
	pai = sum * 4;
	printf("pai=%f\nflag=%d\n", pai, flag);
	return 0;
}